unit usermobilesame;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, cxGraphics, cxControls, cxLookAndFeels, cxLookAndFeelPainters,
  cxStyles, dxSkinsCore, dxSkinsDefaultPainters, dxSkinscxPCPainter,
  cxCustomData, cxFilter, cxData, cxDataStorage, cxEdit, cxNavigator, DB,
  cxDBData, cxImage, cxMemo, cxGridCardView, cxGridDBCardView,
  cxGridCustomLayoutView, StdCtrls, ExtCtrls, cxGridLevel,
  cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxClasses,
  cxGridCustomView, cxGrid, MemDS, DBAccess, Uni, cxBlobEdit;

type
  Tfrmusermobilesame = class(TForm)
    cards: TUniQuery;
    cardscontact_id: TWideStringField;
    cardsgid: TWideStringField;
    cardsgroup_id: TWideStringField;
    cardscardsource: TWideStringField;
    cardscardstate: TWideStringField;
    cardscloudcheck: TWideStringField;
    cardssync_cid: TWideStringField;
    cardstimecreate: TWideStringField;
    cardsusername: TWideStringField;
    cardsmobile: TWideStringField;
    cardstel: TWideStringField;
    cardsfax: TWideStringField;
    cardsemail: TWideStringField;
    cardswebsite: TWideStringField;
    cardsqq: TWideStringField;
    cardscountry: TWideStringField;
    cardsstate: TWideStringField;
    cardscity: TWideStringField;
    cardsstreet1: TWideStringField;
    cardsstreet2: TWideStringField;
    cardszip: TWideStringField;
    cardscompany: TWideStringField;
    cardsdepartment: TWideStringField;
    cardstitle: TWideStringField;
    cardsjsonstr: TWideMemoField;
    cardsocrtext: TWideMemoField;
    cardsjsonstrback: TWideMemoField;
    cardsocrtextback: TWideMemoField;
    cardsfront_binary: TBlobField;
    cardsback_binary: TBlobField;
    cardssamecardid: TWideStringField;
    cxGrid1: TcxGrid;
    cxGrid1DBTableView1: TcxGridDBTableView;
    cxGrid1DBTableView1samecardid: TcxGridDBColumn;
    cxGrid1DBTableView1rcnt: TcxGridDBColumn;
    cxGrid1DBTableView2: TcxGridDBTableView;
    cxGrid1DBTableView2username: TcxGridDBColumn;
    cxGrid1DBTableView2mobile: TcxGridDBColumn;
    cxGrid1DBTableView2rcnt: TcxGridDBColumn;
    cxGrid1DBTableView3: TcxGridDBTableView;
    cxGrid1DBTableView3mobile: TcxGridDBColumn;
    cxGrid1DBTableView3rcnt: TcxGridDBColumn;
    cxGrid1DBTableView4: TcxGridDBTableView;
    cxGrid1DBTableView4username: TcxGridDBColumn;
    cxGrid1DBTableView4email: TcxGridDBColumn;
    cxGrid1DBTableView4rcnt: TcxGridDBColumn;
    cxGrid1DBTableView5: TcxGridDBTableView;
    cxGrid1DBTableView5username: TcxGridDBColumn;
    cxGrid1DBTableView5tel: TcxGridDBColumn;
    cxGrid1DBTableView5rcnt: TcxGridDBColumn;
    cxGrid1Level2: TcxGridLevel;
    namemobilesame: TUniQuery;
    namemobilesameusername: TWideStringField;
    namemobilesamemobile: TWideStringField;
    namemobilesamercnt: TLargeintField;
    pnl1: TPanel;
    pnl2: TPanel;
    btn1: TButton;
    cxGrid2: TcxGrid;
    cxGrid2DBCardView1: TcxGridDBCardView;
    cxGrid2DBCardView1front_binary: TcxGridDBCardViewRow;
    cxGrid2DBCardView1back_binary: TcxGridDBCardViewRow;
    cxGrid2DBCardView1contact_id: TcxGridDBCardViewRow;
    cxGrid2DBCardView1gid: TcxGridDBCardViewRow;
    cxGrid2DBCardView1group_name: TcxGridDBCardViewRow;
    cxGrid2DBCardView1timecreate: TcxGridDBCardViewRow;
    cxGrid2DBCardView1username: TcxGridDBCardViewRow;
    cxGrid2DBCardView1mobile: TcxGridDBCardViewRow;
    cxGrid2DBCardView1tel: TcxGridDBCardViewRow;
    cxGrid2DBCardView1fax: TcxGridDBCardViewRow;
    cxGrid2DBCardView1email: TcxGridDBCardViewRow;
    cxGrid2DBCardView1website: TcxGridDBCardViewRow;
    cxGrid2DBCardView1qq: TcxGridDBCardViewRow;
    cxGrid2DBCardView1country: TcxGridDBCardViewRow;
    cxGrid2DBCardView1state: TcxGridDBCardViewRow;
    cxGrid2DBCardView1city: TcxGridDBCardViewRow;
    cxGrid2DBCardView1street1: TcxGridDBCardViewRow;
    cxGrid2DBCardView1street2: TcxGridDBCardViewRow;
    cxGrid2DBCardView1zip: TcxGridDBCardViewRow;
    cxGrid2DBCardView1company: TcxGridDBCardViewRow;
    cxGrid2DBCardView1department: TcxGridDBCardViewRow;
    cxGrid2DBCardView1title: TcxGridDBCardViewRow;
    cxGrid2DBCardView1jsonstr: TcxGridDBCardViewRow;
    cxGrid2DBCardView1ocrtext: TcxGridDBCardViewRow;
    cxGrid2DBCardView1jsonstrback: TcxGridDBCardViewRow;
    cxGrid2DBCardView1ocrtextback: TcxGridDBCardViewRow;
    cxGrid2DBCardView1samecardid: TcxGridDBCardViewRow;
    cxGrid2DBTableView1: TcxGridDBTableView;
    cxGrid2DBTableView1contact_id: TcxGridDBColumn;
    cxGrid2DBTableView1gid: TcxGridDBColumn;
    cxGrid2DBTableView1group_name: TcxGridDBColumn;
    cxGrid2DBTableView1timecreate: TcxGridDBColumn;
    cxGrid2DBTableView1username: TcxGridDBColumn;
    cxGrid2DBTableView1mobile: TcxGridDBColumn;
    cxGrid2DBTableView1tel: TcxGridDBColumn;
    cxGrid2DBTableView1fax: TcxGridDBColumn;
    cxGrid2DBTableView1email: TcxGridDBColumn;
    cxGrid2DBTableView1website: TcxGridDBColumn;
    cxGrid2DBTableView1qq: TcxGridDBColumn;
    cxGrid2DBTableView1country: TcxGridDBColumn;
    cxGrid2DBTableView1state: TcxGridDBColumn;
    cxGrid2DBTableView1city: TcxGridDBColumn;
    cxGrid2DBTableView1street1: TcxGridDBColumn;
    cxGrid2DBTableView1street2: TcxGridDBColumn;
    cxGrid2DBTableView1zip: TcxGridDBColumn;
    cxGrid2DBTableView1company: TcxGridDBColumn;
    cxGrid2DBTableView1department: TcxGridDBColumn;
    cxGrid2DBTableView1title: TcxGridDBColumn;
    cxGrid2DBTableView1jsonstr: TcxGridDBColumn;
    cxGrid2DBTableView1ocrtext: TcxGridDBColumn;
    cxGrid2DBTableView1jsonstrback: TcxGridDBColumn;
    cxGrid2DBTableView1ocrtextback: TcxGridDBColumn;
    cxGrid2DBTableView1front_binary: TcxGridDBColumn;
    cxGrid2DBTableView1back_binary: TcxGridDBColumn;
    cxGrid2DBCardView2: TcxGridDBCardView;
    cxGrid2DBCardView3: TcxGridDBCardView;
    cxGrid2DBCardView3gid: TcxGridDBCardViewRow;
    cxGrid2DBCardView3timecreate: TcxGridDBCardViewRow;
    cxGrid2DBCardView3group_name: TcxGridDBCardViewRow;
    cxGrid2DBCardView3front_binary: TcxGridDBCardViewRow;
    cxGrid2DBCardView3back_binary: TcxGridDBCardViewRow;
    cxGrid2Level1: TcxGridLevel;
    cxGrid2Level2: TcxGridLevel;
    qryexe: TUniQuery;
    ds2: TDataSource;
    ds6: TDataSource;
    procedure FormCreate(Sender: TObject);
    procedure cxGrid1DBTableView2FocusedItemChanged(
      Sender: TcxCustomGridTableView; APrevFocusedItem,
      AFocusedItem: TcxCustomGridTableItem);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frmusermobilesame: Tfrmusermobilesame;

implementation

{$R *.dfm}

procedure Tfrmusermobilesame.cxGrid1DBTableView2FocusedItemChanged(
  Sender: TcxCustomGridTableView; APrevFocusedItem,
  AFocusedItem: TcxCustomGridTableItem);
begin
  with cards do
  begin
    close;
    sql.Text := 'select * from camcards_cards '
    + ' where username=:username and mobile=:mobile '
    + 'and  samecardid=contact_id ';
    ParamByName('username').Value := namemobilesame.FieldByName('username').AsString;
    ParamByName('username').Value := namemobilesame.FieldByName('username').AsString;
    open;
  end;
end;

procedure Tfrmusermobilesame.FormCreate(Sender: TObject);
begin
  namemobilesame.Close;
  namemobilesame.Open;
end;

end.
